extends "AzurItem.gd"

var dmg = 0
func setItemType():
	itemType = sys.ItemType.GUN

func _connect():
	._connect()
	if masCha.id == "merchant":return
	yield(sys.get_tree().create_timer(0.2), "timeout")
	if not masCha.mainFlag or masCha.mainId == id and masCha.mainName.find("史诗") > -1:
		delFromCha()
		return	
	if masCha.mainId == id and masCha.mainName.find("史诗") == -1 or upgraded:
		dmg += int(dmg * 0.4)
		name = name.replace("[普通]", "[史诗]")

	if skPool == null:
		init()
		yield(sys.get_tree().create_timer(0.3), "timeout")

	if masCha.mainSk != null:
		masCha.mainSk.remove()
	masCha.mainName = name
	masCha.mainDmg = dmg
	masCha.mainTxt = info
	masCha.mainSk = call("learnSkill")
	masCha.mainId = id
	masCha.attEx.spd -= masCha.spd
	masCha.attEx.spd += att.spd
	masCha.spd = att.spd
	masCha.upAtt()
	delSelf()

func manualAdd(masCha):
	self.masCha = masCha
	if not masCha.mainFlag:
		delFromCha()
		return
	if masCha.mainSk != null:
		masCha.mainSk.remove()
	initVars()
	delayInit()
	masCha.mainName = name
	masCha.mainDmg = dmg
	masCha.mainTxt = info
	masCha.mainSk = call("learnSkill")
	masCha.mainId = id
	masCha.attEx.spd -= masCha.spd
	masCha.attEx.spd += att.spd
	masCha.spd = att.spd
	masCha.upAtt()
	del()

